﻿namespace ChumChase.Extensions
{
    using System.Collections.Generic;
    using System.Windows;
    using Model;

    public static class ExtensionMethods
    {
        public static void AddDataTemplateFor<TModel, TView>(this IList<DataTemplate> templates)
            where TView : UIElement
        {
            var template = new DataTemplate(typeof (TModel));
            var factory = new FrameworkElementFactory(typeof (TView));
            template.VisualTree = factory;
            templates.Add(template);
        }

        public static string DetermineFileName(this IFeedProviderSettings settings)
        {
            return string.Format(
                "{0}.config.dat",
                settings.GetType().Name);
        }
    }
}